{include inc/top.html}
<script src="{__DATA_URL__}js/jquery.rvf.1.2.js"></script>
<script src="{__CURTPL_URL__}js/form.js"></script>
<script>
    function preview(file){
        $('#preview').attr('src' , '{__UPLOAD_URL__}' + file.url);
        $('#cover').val(file.url);
    }
</script>
<div class="index-main">
    <h1 class="h-title">{$atitle}
        <span class="sub-nav">
            <a href="{url:'admin@cat-list-ctype-%d' , $ctype}">返回列表</a>
        </span>
     </h1>
    <br/>
    <form action="{url:'admin@cat-save'}" id="form" method="post" class="form">
    <input type="hidden" name="cat[ctype]" value="{$cat['ctype'] ? intval($cat['ctype']) : $ctype}"/>
    <input type="hidden" name="cat[id]"    value="{$cat['id'] ? intval($cat['id']) : 0}"/>
    <input type="hidden" name="cat[cover]" id="cover" value="{$cat['cover']}"/>
    <input type="hidden" name="cat[path]" id="cover" value="{$cat['path'] ? $cat['path'] : ''}"/>
    <table class="table">
        <tr>
            <td class="td right"  width="80">名称:</td>
            <td class="td left" >
                <input type="text" name="cat[name]" class="req input" nullmsg="请输入分类名称" errmsg="请输入您所应聘的职位" rule="require" msgid="name_msg" value="{$cat['name']}"/>
                <span id="name_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right" >映射:</td>
            <td class="td left" >
                <input type="text" name="cat[sname]" class="req input" nullmsg="请输入分类映射" errmsg="最多只能输入20个字符" rule="require" msgid="sname_msg" notmust="1" maxlimit="30" value="{$cat['sname']}"/>
                <span id="sname_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right">所属分类:</td>
            <td class="td left" >
                <select name="cat[parent]" class="select">
                    <option value="0">作为一级分类</option>
                    {foreach $plist $k $v}
                        <option value="{$v['id']}" {$v['id'] == $cat['parent'] ? 'selected' : ''}>
                            {if substr_count($v['path'] , '#') > 2 }
                                {:str_repeat('&nbsp;&nbsp;&nbsp;' , substr_count($v['path'] , '#') - 3)}
                                &nbsp;└&nbsp;
                            {/if}
                            {$v['name']}</option>
                    {/foreach}
                </select>
                <span id="name_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right" >排序:</td>
            <td class="td left" >
                <input type="text" name="cat[sort]" class="req intval input" nullmsg="请输入分类排序" errmsg="请输入9999以下的数字" rule="number" maxlimit="4" msgid="sort_msg"  maxlimit="20" value="{:intval($cat['sort'])}"/>
                <span id="sort_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right" >关键字:</td>
            <td class="td left" >
                <input type="text" name="cat[key]" class="req input" errmsg="最多只能输入50个字" rule="require" msgid="key_msg" notmust="1" maxlimit="50" wlen="1" value="{$cat['key']}"/>
                <span id="key_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right" >描述:</td>
            <td class="td left" >
                <input type="text" name="cat[desc]" class="req input" errmsg="最多只能输入50个字" rule="require" msgid="desc_msg" notmust="1" maxlimit="50"  wlen="1" value="{$cat['desc']}"/>
                <span id="desc_msg" class="error-tips"></span>
            </td>
        </tr>
        <tr>
            <td class="td right" >封面:</td>
            <td class="td left" >
                <div>
                {if $cat['cover']}
                    <img src="{__UPLOAD_URL__}{$cat['cover']|thumb}" id="preview" class="border-gray" width="110"/>
                {else}
                    <img src="{__DATA_URL__}images/null.gif"   id="preview" class="border-gray" width="110"/>
                {/if}
                </div>
                <iframe src="{url:'admin@system-upload-water-1-tw-110-th-80-cb-preview'}" style="height:30px;width:120px;border:none;overflow:hidden;" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
            </td>
        </tr>
        <tr>
            <td class="td right" ></td>
            <td class="td left"><input type="button" id="sbtn" url="{url:'cat-save'}"  class="button" value="确定"/></td>
        </tr>

    </table>
    <div class="clear"></div>
</div>
{include inc/bottom.html}